package com.hanserwei.springbootlearn.mapper;

import com.hanserwei.springbootlearn.entity.Student;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface StudentMapper {

    @Select("select * from students")
    @Results({
            @Result(id = true, column = "student_id", property = "studentId"),
            @Result(column = "student_name", property = "studentName"),
            @Result(column = "age", property = "age"),
            @Result(column = "gender", property = "gender"),
            @Result(column = "student_id", property = "teachers",many = @Many(select = "com.hanserwei.springbootlearn.mapper.TeacherMapper.queryTeachersByStudentId"))
    })
    List<Student> queryAllStudents();
}
